package thread;

public class SyncDemo2 {
    public static void main(String[] args) {
        Thread d = new Thread(Boo::diSome);
        d.start();
        Thread r = new Thread(Boo::diSome);
        r.start();
        /*
        Thread s = new Thread(){
            public void run(){
                Boo.diSome();
            }
        };

        s.start();

         */
        /*
        Thread s = new Thread(new Runnable() {
            public void run() {
                Boo.diSome();
            }
        });
        s.start();

         */
    }
}

class Boo{
    public static void diSome(){
        try {
            Thread t = Thread.currentThread();
            System.out.println("开始吃饭");
            Thread.sleep(2000);
            System.out.println("吃完了,睡觉");
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
